package cn.schoolwow.quickdao.module.operation.flow.upgrade;

import cn.schoolwow.quickdao.domain.database.parent.UpgradeRequest;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;
import org.apache.commons.lang3.Validate;

public class CheckUpgradeRequestFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        UpgradeRequest upgradeRequest = flowContext.checkInstanceData(UpgradeRequest.class);

        Validate.notEmpty(upgradeRequest.comment, "升级语句注释不能为空");
        Validate.notNull(upgradeRequest.upgradeConsumer, "未指定升级语句");
    }

    @Override
    public String name() {
        return "检查数据库升级请求";
    }
}
